<template>
	<view class="content">
		<image src="/static/home/1.jpg" style="width: 100vw; height: 234rpx; display: block;"></image>
		<view style="background-color: white;">
			<view @click="itemClick(index)" class="flex-colume-center item0" v-for="(item,index) in dataArr">
				<image style="margin-bottom: 10rpx; width: 80rpx; height: 80rpx;" :src="getHomeImg(index)"></image>
				<view style="font-size: 28rpx;">{{item}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
			
				// dataArr:['赛事列表','发起比赛','我的活动','消费券','我的关注','积分查询']
				dataArr:['个人发布','个人发布管理','机构发布','机构发布管理','球馆发布','球馆发布管理']
			
			}
		},
		onLoad(e) {
			var token = uni.getStorageSync('publish-mix-token')
			if (!token){
				uni.login({
					success: (res) => {
						setTimeout(res1 => {
							this.requestLogin(res.code)
						}, 500)
					},
					fail: () => {
						uni.hideLoading()
					}
					
				})
				
				return
			}
			
		},
		onShow() {

		},

		methods: {
			itemClick(index){
				var url = ''
				if (index == 0){
					url = '/pages/publish/personalPublish'
				}
				if (index == 1){
					url = '/pages/publish/publishList?type=1'
				}
				if (index == 2){
					url = '/pages/publish/agencyPublish'	
				}
				if (index == 3){
					url = '/pages/publish/publishList?type=2'
				}
				if (index == 4){
					url = '/pages/publish/ballPublish'	
				}
				if (index == 5){
					url = '/pages/publish/publishList?type=3'
				}
				uni.navigateTo({
					url:url
				})
				
			},
			getHomeImg(index){
				return '/static/home/distribution_icon'+ (index +1) + '.png'
			},
			requestLogin(code){
				login({open_id_code:code}).then(res=>{
					if(res.data.code == 200){
						var data = res.data.data
						uni.setStorageSync('publish-mix-token',data.info.utoken)
						return
						
					}
					uni.$u.toast(res.data.message)
					
				})
				
			}
				
		}
	}
</script>
<style>

</style>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-start;

		.logoImg {
			width: 200rpx;
			height: 200rpx;
			margin-top: 8vh;
		}
	}
	.item0{
		float: left;
		width: 187.5rpx;
		height: 150rpx;
		font-size: 0rpx;
		margin-top: 10rpx;
		margin-bottom: 20rpx;
	}
	
	.input-box1{
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		width: 650rpx;
		height: 80rpx;
		border-radius: 16rpx;
		background-color: rgb(238, 238, 238);
		padding: 0rpx 25rpx;
		margin-bottom: 16rpx;
		box-sizing: border-box;
		.t1{
			font-size: 30rpx;
			color: black;
			font-weight: 600;
			width: 120rpx;
			text-align: left;
		}
		.t2{
			font-size: 26rpx;
			color: black;
		}
		input{
			flex: 1;
			font-size: 26rpx;
			background-color: rgba(0, 0, 0, 0);
		}
	}
	
	.sureBtn{
		margin-top: 50rpx;
		border-radius: 40px;
		width: 650rpx;
		height: 74rpx;
		line-height: 74rpx;
		text-align: center;
		background: linear-gradient(98deg, #89A3FF 0%, #7C5ADE 100%);
		font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
		font-weight: 600;
		font-size: 32rpx;
		color: white;
	}

	.successPage {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-start;
		margin-top: 100rpx;
	}
	.phone-btn{
		color: white;
		height: 40px;
		line-height: 40px;
		background-color: rgb(0, 128, 0)
	}
</style>